package com.cy.pj.brand.service;

import com.cy.pj.brand.dao.BrandDao;
import com.cy.pj.brand.pojo.Brand;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BrandServiceImpl implements BrandService{

    @Autowired
    private BrandDao brandDao;

    @Override
    public List<Brand> findBrands(String name) {
        return brandDao.findBrands(name);
    }

    @Override
    public int deleteById(Integer id) {
        int rows = brandDao.deleteById(id);
        return rows;
    }

    @Override
    public int saveBrand(Brand brand) {
        int rows = brandDao.insertBrand(brand);
        return rows;
    }

    @Override
    public Brand findById(Integer id) {
        return brandDao.findById(id);
    }

    @Override
    public int updateBrand(Brand brand) {
        return brandDao.updateBrand(brand);
    }
}
